<?php
class Common
{		

	// Mysql Variables
	var $mysqlUser = 'pepgsou_manix';
	var $mysqlDb = 'pepgsou_math';
	var $mysqlHost = 'localhost';
	var $mysqlDbPass = 'pygrace';
	var $dbc;

		
	function mysqlConnect()
	{
		if($this->dbc = mysql_connect ($this->mysqlHost, $this->mysqlUser, $this->mysqlDbPass)) 
		{	
			if (!mysql_select_db ($this->mysqlDb)) 
			{
				$this->logError('Error connecting to mysql: Could not select the '.$this->mysqlDb.' database.',__FILE__, __LINE__);
			}
		}
		else
		{
			$this->logError('Error connecting to mysql: Could not connect',__FILE__, __LINE__);
		}
	
	}
	
	function logError ($message, $file, $line) 
	{
		$message = 'An error occurred in script ' . $file . ' on line ' . $line . ': '.$message;
		echo '<font color="red">', $message, '</font>';
		die;
	}


	function displayHeaderHtml()
	{
		?>
		<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
		"http://www.w3.org/TR/html4/loose.dtd">
		<html>
		<head>
		<title>SSHS Calculator Database</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
			<link href="css/table_styles.css" rel="stylesheet" type="text/css" />
			<link href="css/icon_styles.css" rel="stylesheet" type="text/css" />
			
			<script type="text/javascript" src="js/prototype.js"></script>				
			<script type="text/javascript" src="js/ajax_table_editor.js"></script>

			<!-- calendar files -->
			<link rel="stylesheet" type="text/css" media="all" href="js/jscalendar/skins/aqua/theme.css" title="win2k-cold-1" /> 
			<script type="text/javascript" src="js/jscalendar/calendar.js"></script>
			<script type="text/javascript" src="js/jscalendar/lang/calendar-en.js"></script>
			<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>	
		</head>	
		<body>
		<?php
	}	
	
	function displayFooterHtml()
	{
		?>
		</body>
		</html>
		<?php
	}	

}
?>
